package creational.property.reigister;

import java.util.HashMap;
import java.util.Map;

public class CarPropertyManager {
    private static CarPropertyManager s_pCarPropertyManager;
    private Map<String, ICar> m_mapProperty;

    private CarPropertyManager() {
        m_mapProperty = new HashMap<String, ICar>();
    }

    public static CarPropertyManager getInstance() {
        if (s_pCarPropertyManager == null) {
            s_pCarPropertyManager = new CarPropertyManager();
        }

        return s_pCarPropertyManager;
    }

    public synchronized ICar getProperty(String strName) {
        return this.m_mapProperty.get(strName);
    }

    public synchronized void setProperty(String strName, ICar pICar) {
        this.m_mapProperty.put(strName, pICar);
    }

}
